//用户名验证
//0 姓名 1手机号 2 邮箱
function checkForm(type, id) {
        switch (type) {
        case 0:
            var res = /^[\u4E00-\u9FA5]+$/;
            var ms="姓名不合法"
            break;
        case 1:
            var res = /^(13|15|17|18)\d{9}$/;
            var ms="请重新确认手机号"
            break;
        case 2:
            var res = /^\w+@\w+(\.\w+){1,2}$/;
            var ms="邮箱错误"
            break;
        }
       
        if ($(id).val()== "") {
            $(id).next().html("不能为空");
            $(id).next().css("color", "red");
            return false;
        }
        if ($(id).val().search(res) == -1) {
            $(id).next().html(ms);
            $(id).next().css("color", "red");
            return false;
            
        }else {
            $(id).next().css("color", "green");
            $(id).next().html("正确");
            return true;
        }
   
}
//获取验证码
function settime(id, secodes) {
    var countdown = secodes;
    if (countdown == 0) {
        $(id).attr('disabled', false);
        $(id).addClass("dk-bgBlue");
        $(id).val("获取验证码");
        countdown = 60;
        return;
    }
    else {
        $(id).attr('disabled', true);
        $(id).removeClass("dk-bgBlue");
        $(id).val("重新发送" + countdown + "s");
        countdown--;
    }
    setTimeout(function () {
        settime(id, countdown)
    }, 1000)
}